<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNetworkTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('network', function (Blueprint $table) {
            $table->increments('id');
            $table->string('designation')->index()->comment('网点名称');
            $table->string('name')->index()->comment('负责人姓名');
            $table->string('phone')->index()->comment('手机号');
            $table->unsignedInteger('express_id')->index()->comment('快递公司id');
            $table->unsignedInteger('province_id')->index()->comment('省');
            $table->unsignedInteger('city_id')->index()->comment('市');
            $table->unsignedInteger('district_id')->index()->comment('县/区');
            $table->string('address')->comment('详细地址');
            $table->string('cover')->nullable()->comment('网点封面图片');
            $table->string('start_time')->default("09:00")->comment('开始营业时间');
            $table->string('end_time')->default("18:00")->comment('结束营业时间');
            $table->decimal('arrears_money', 10, 2)->default(0.00)->comment('欠款');
            $table->decimal('settlement_money', 10, 2)->default(0.00)->comment('历史结算');
            $table->decimal('balance_money', 10, 2)->default(0.00)->comment('余额');
            $table->integer('delivery_sum')->default(0)->comment('历史入库');
            $table->integer('send_sum')->default(0)->comment('历史签收');
            $table->unsignedTinyInteger('status')->default(0)->comment('运营状态 0:申请开通  1:运营中  2：已停业');
            $table->string('region_mark')->nullable()->comment('备注');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('network');
    }
}
